import logging
import time
import unittest
from page import Page
from ddt import ddt
@ddt
class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.pg=Page()
        # 退出
    def tearDown(self):
        self.pg.tuichu()
    def test_something(self,yq,sj):
        logging.error('点击搜索')
        # 异常处理
        try:
            self.pg.sou().click()
        except:
            logging.error('未找到元素')
            self.pg.jieping('1.png')
        logging.error('搜索框输入文字:我的阿勒泰')
        # 强制等待
        time.sleep(3)
        self.pg.sou1().send_keys()
        logging.error('点击搜索按钮')
        time.sleep(3)
        self.pg.dianjisouuso().click()
        logging.error('点击图片')
        self.pg.tu().click()
        logging.error('点击加入购物车')
        self.pg.tianjiagwc().click()
        yq='我的阿勒泰'
        sj=self.pg.zhegeyemian()
        self.assertEqual(yq,sj)
        self.assertIn(yq, sj)


if __name__ == '__main__':
    unittest.main()
